//
//  SCNAnnouncementModels.swift
//  ShoucainuSwift
//
//  Created by 王家旭 on 2017/5/9.
//  Copyright © 2017年 Riluee. All rights reserved.
//

import UIKit
import ObjectMapper



class SCNAnnouncementViewModels: NSObject {
    
    func requestOtherNoticeNew(_ param: [String : String], successBlock:@escaping ((_ dataresult: SCNAnnouncementResultModels) -> Void)) -> Void {

        SCNRequestManager.postRequest(param, URL: SCNRequestAPI.other().noticeNew) { (response) in
            
            let announcementModels = Mapper<SCNAnnouncementModels>().map(JSONObject: response.result.value)
            
            if let tmp = announcementModels?.dataresult {
                successBlock(tmp)
                
                
            }
        }

        
    }
}

class SCNAnnouncementModels: Mappable {
    var dataresult: SCNAnnouncementResultModels?
    var errmsg: String?
    var status: Int?
    var servertime: Int?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        dataresult <- map["dataresult"]
        errmsg <- map["errmsg"]
        status <- map["status"]
        servertime <- map["servertime"]
    }

}

class SCNAnnouncementResultModels: Mappable {
    var list: [SCNAnnouncementListModels]?
    var count: Int?
    var num: Int?
    var total: Int?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        list <- map["list"]
        count <- map["count"]
        num <- map["num"]
        total <- map["total"]
    }

}
class SCNAnnouncementListModels: Mappable {
    
    var timeadd: String?
    var title: String?
    var url: String?
    
    
    
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        
        timeadd <- map["timeadd"]
        title <- map["title"]
        url <- map["url"]
    }
    
}
